package com.dongdongshop.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.dongdong.pojo.TbContentCategory;
import com.dongdong.service.ContentCategoryService;
import com.dongdongshop.mapper.TbContentCategoryMapper;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
@org.springframework.stereotype.Service
public class ContentCategoryServiceImpl implements ContentCategoryService {

    @Autowired
    private TbContentCategoryMapper tbContentCategoryMapper;

    @Override
    public List<TbContentCategory> selectAll() {
        List<TbContentCategory> contentCategories = tbContentCategoryMapper.selectByExample(null);
        return contentCategories;
    }

    @Override
    public boolean insert(TbContentCategory tbContentCategory) {
        int i = tbContentCategoryMapper.insertSelective(tbContentCategory);
        return i > 0;
    }

    @Override
    public boolean deleteId(Long id) {
        int i = tbContentCategoryMapper.deleteByPrimaryKey(id);
        return i > 0;
    }

    @Override
    public TbContentCategory selectId(Long id) {
        TbContentCategory tbContentCategory = tbContentCategoryMapper.selectByPrimaryKey(id);
        return tbContentCategory;
    }

    @Override
    public boolean update(TbContentCategory tbContentCategory) {
        int i = tbContentCategoryMapper.updateByPrimaryKeySelective(tbContentCategory);
        return i > 0;
    }
}
